<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>

	<body>
		<input type="button" value="隐藏" onclick="fun(this)">
		<div id="test">我是一个DIV</div>
	</body>

	<script>
		function fun(obj) {
			var div = document.getElementById("test");
			if(obj.value == "隐藏") {
				div.style.display = "none";
				obj.value = "显示";
			} else {
				div.style.display = "block";
				obj.value = "隐藏";
			}
		}
	</script>

	
</html>